<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui" xmlns:pm="http://primefaces.org/mobile" xmlns:pt="http://xmlns.jcp.org/jsf/passthrough" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns:ui="http://java.sun.com/jsf/facelets">
<h:body>
		<ui:composition template="/admin/template.xhtml">
				<ui:define name="body">

						<h:form>
								<p:panel id="create-panel" header="创建新病种" style="margin-bottom:10px;">
										<p:messages id="create-messages" />
										<h:panelGrid columns="3" cellpadding="5">

												<p:outputLabel for="foodName" value="病种名称" />
												<p:inputText id="foodName" required="true" value="#{illnessCategory.illnessName}" />

										</h:panelGrid>

										<p:commandButton value="创建新病种" type="button" onclick="PF('cd').show()" />
										<p:commandButton value="重置" type="reset"></p:commandButton>
								</p:panel>

								<p:confirmDialog widgetVar="cd" header="操作确认" severity="info">
										<f:facet name="message">
												<h:outputText value="是否创建新病种" />
										</f:facet>
										<p:commandButton value="创建新病种" update="@form :query-list-form" oncomplete="PF('cd').hide()" actionListener="#{illnessCategoryController.createInstance}" />
										<p:commandButton value="取消" type="button" onclick="PF('cd').hide()"></p:commandButton>
								</p:confirmDialog>
						</h:form>

						<h:form id="query-list-form">
								<p:panel id="query-panel" header="已有病种列表" style="margin-bottom:10px;">
										<p:messages id="modify-msgs" />
										<p:dataTable id="table" var="bean" value="#{illnessCategoryController.illNessCategoryList}">

												<p:column headerText="ID" style="width: 30px">
														<h:outputText value="#{bean.id}" />
												</p:column>
												<p:column headerText="病种名称" style="width: 60px">
														<h:outputText value="#{bean.illnessName}" />
												</p:column>

												<p:column headerText="操作" style="text-align: center; width: 140px;">
														<p:commandButton icon="ui-icon-document" value="修改" oncomplete="PF('modify-dlg').show()" process="@this" update=":query-list-form:modify-panel" actionListener="#{illnessCategoryController.loadSelectedBean(bean.id)}">
																<f:setPropertyActionListener value="#{bean}" target="#{illnessCategoryController.selectedBean}"></f:setPropertyActionListener>
														</p:commandButton>
												</p:column>
										</p:dataTable>
								</p:panel>
								<p:dialog widgetVar="modify-dlg" header="修改病种">
										<p:panel id="modify-panel" header="修改病种" style="margin-bottom:10px;">
												<h:panelGrid columns="3" cellpadding="5">

														<p:outputLabel for="foodName" value="病种名称" />
														<p:inputText id="foodName" required="true" value="#{illnessCategoryController.selectedBean.illnessName}" style="width: 400px" />
														<h:outputText value="(病种名称)"></h:outputText>

												</h:panelGrid>

												<p:commandButton value="修改病种名称" actionListener="#{illnessCategoryController.updateInstance}" process="modify-panel" update="@form" oncomplete="PF('modify-dlg').hide()" />
												<p:commandButton value="取消" type="button" onclick="PF('modify-dlg').hide()"></p:commandButton>
										</p:panel>
								</p:dialog>
						</h:form>

				</ui:define>
		</ui:composition>
</h:body>
</html>